class Solution {
public:
    vector<int> getSumAbsoluteDifferences(vector<int>& nums) {
             vector<int>  a(nums.size()+1);
             vector<int> b(nums.size());
               for(int i=0;i<nums.size();i++){
                  a[i+1]=a[i]+nums[i];
               }
           for(int i=0;i<nums.size();i++){
                int c= (a[nums.size()] - a[i]) - (a[i] - a[0])  + nums[i] * (i - (nums.size() - i));
                b[i]=c;
           }
     return b;
    }
};
